<%@ page pageEncoding="utf-8" import="java.util.*" %>
<%@ page import="DoMain.Student" %>
<%@ page import="DoMain.Department" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <title>查看二级学院信息</title>
    <script type="text/javascript" src="script/jquery-3.3.1.js"></script>
    <script type="text/javascript">

		$(function(){
			
			$(".delete").click(function(){
				
				var content=$(this).parent().parent().find("td:eq(1)").text();
				var flag=confirm("确定要删除"+content+"的信息吗？");
				
				return flag;
				
			});	
		});
		
</script>
  </head>
  <body>
<a href="queryDepartment.Co">查询二级学院信息</a>
<form action="queryDepartment.Co" method="post">
<br>
  <div><span>学院名称</span><input type="text" name="departName">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="btn btn-primary" value="查询">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="newDepartment.jsp">Add new Department</a></div>
  </form>

  <%	
  		List<Department> departments=(List<Department>)request.getAttribute("departments"); 
  		
  		%>
  
  
  <table class="table table-hover">

    <tr class="table-primary" align="center">
      <th scope="col" align="center">学院编号</th>
      <th scope="col" align="center">学院名称</th>
      <th scope="col" align="center">操作</th>
    </tr>


 			 <c:forEach items="${departments}" var="de">
			<tr  class="table-light">
				<td class="table-success" scope="row" align="center">${de.departNo}</td>
				<td class="table-success" scope="row" align="center">${de.departName}</td>
				<td align="center"><a href="get.Co?departNo=${de.departNo}">修改</a>|<a class="delete" href="delete.Co?departNo=${de.departNo}">删除</a>
				
			</tr>
			</c:forEach>
  	</table> 	
  </body>
  </html>